package cn.base.day08;

public class Test09 {
    public static void main(String[] args) {
        int[] arr = {1, 2, 3, 8, 4, 9};
        String s = arrToString(arr);
        System.out.println(s);
    }

    public static String arrToString(int[] arr) {
        StringBuilder s1 = new StringBuilder("[");
        for (int i = 0; i < arr.length; i++) {
            if (i == arr.length - 1) {
                s1.append(arr[i]);
            } else {
                s1.append(arr[i]).append(",");
            }
        }
        s1.append("]");
        return s1.toString();
    }
}
